//
//  TTSendBottomMailView.m
//  TaoTuo
//
//  Created by LG on 2020/8/15.
//  Copyright © 2020 刘广. All rights reserved.
//

#import "TTSendBottomMailView.h"

@interface TTSendBottomMailView ()
/// 店铺名
@property (weak, nonatomic) IBOutlet UILabel *shopNameLabel;
@property (weak, nonatomic) IBOutlet UIView *addressBgView;
@property (weak, nonatomic) IBOutlet UILabel *addressLabel;
@property (weak, nonatomic) IBOutlet UILabel *receiveLabel;
@property (weak, nonatomic) IBOutlet UILabel *phoneLabel;
@property (weak, nonatomic) IBOutlet UILabel *infoLabel;
@property (weak, nonatomic) IBOutlet UILabel *sendInfoLabel;

@end

@implementation TTSendBottomMailView

- (void)awakeFromNib
{
    [super awakeFromNib];
    
    self.addressBgView.layer.cornerRadius = 5;
    self.addressBgView.layer.borderColor = UIColorHex(#9748EC).CGColor;
    self.addressBgView.layer.borderWidth = 0.5;
    
    NSString *str = _sendInfoLabel.text;
    UIColor *color = UIColorHex(#F1353F);
    NSMutableAttributedString *attr = [[NSMutableAttributedString alloc] initWithString:str];
    [attr addAttribute:NSForegroundColorAttributeName value:color range:[str rangeOfString:@"顺丰"]];
    [attr addAttribute:NSForegroundColorAttributeName value:color range:[str rangeOfString:@"EMS"]];
    [attr addAttribute:NSForegroundColorAttributeName value:color range:[str rangeOfString:@"包装"]];
    [attr addAttribute:NSForegroundColorAttributeName value:color range:[str rangeOfString:@"证书"]];
    [attr addAttribute:NSForegroundColorAttributeName value:color range:[str rangeOfString:@"发票"]];
    self.sendInfoLabel.attributedText = attr;
    
}

- (void)setModel:(TTSendStoreListModel *)model
{
    _model = model;
    
    self.shopNameLabel.text = model.storeName;
    self.addressLabel.text = model.storeAddress;
    self.receiveLabel.text = model.customerName;
    self.phoneLabel.text = model.customerPhone;
    
}

/// 选择店铺
- (IBAction)changeShopAction:(id)sender {
    
    NSLog(@"选择店铺");
    
    if (self.afterSelectAddressBlock) {
        self.afterSelectAddressBlock(self);
    }
    
}



@end
